package schoolWord;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test1 {
    public static void main(String[] args) {

        //c.“2024-5-12”转成日期对象（即字符串解析成）
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = null;
        try {
            date = sdf.parse("2024-5-12");
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }
        System.out.println(date);
    }
}
